package com.xjf.springboot001;

import org.apache.coyote.http11.AbstractHttp11Protocol;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.context.annotation.Bean;

/**
 *
 * 功能描述:
 *
 * @param:
 * @return:
 * @auther: xujianfeng
 * @date: 2018/10/17 11:23
 *  在启动类中添加对mapper包扫描@MapperScan
 *  或者直接在Mapper类上面添加注解@Mapper
 *  建议使用上面那种，不然每个mapper加个注解也挺麻烦的
 */
@SpringBootApplication
@MapperScan("com.xjf.springboot001.mapper")
public class Springboot001Application {
    public static void main(String[] args) {
        SpringApplication.run(Springboot001Application.class, args);
    }

    //Tomcat large file upload connection reset
    //为了解决，上传文件大于10M出现连接重置的问题。此异常内容GlobalException也捕获不到。
//    @Bean
//    public TomcatEmbeddedServletContainerFactory tomcatEmbedded() {
//        TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
//        tomcat.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> {
//            if ((connector.getProtocolHandler() instanceof AbstractHttp11Protocol<?>)) {
//                //-1 means unlimited
//                ((AbstractHttp11Protocol<?>) connector.getProtocolHandler()).setMaxSwallowSize(-1);
//            }
//        });
//        return tomcat;
//    }
}
